/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


package Janelas;
import persistencia.*;
public class CadastroFuncionario extends javax.swing.JFrame {

    /** Creates new form ModeloPrincipal */
    public CadastroFuncionario() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        cadastrodeFuncionarios = new javax.swing.JLabel();
        cadastroFuncionariosRotuloNome = new javax.swing.JLabel();
        cadastroFuncionariosCampoNome = new javax.swing.JTextField();
        cadastroFuncionariosRotuloCPF = new javax.swing.JLabel();
        cadastroFuncionariosCampoCPF = new javax.swing.JTextField();
        cadastroFuncionariosRotuloEndereco = new javax.swing.JLabel();
        cadastroFuncionariosCampoRua = new javax.swing.JTextField();
        cadastroFuncionariosRotuloTelefone = new javax.swing.JLabel();
        cadastroFuncionariosCampoTelefone = new javax.swing.JTextField();
        cadastroFuncionariosBotaoSalvar = new javax.swing.JButton();
        cadastroFuncionariosBotaoCancelar = new javax.swing.JButton();
        cadastroFuncionariosRotuloCargo = new javax.swing.JLabel();
        cadastroFuncionariosCampoCargo = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        cadastrodeFuncionarios.setFont(new java.awt.Font("DejaVu Sans", 1, 14));
        cadastrodeFuncionarios.setText("Cadastro de funcionários");

        cadastroFuncionariosRotuloNome.setText("Nome ");

        cadastroFuncionariosCampoNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroFuncionariosCampoNomeActionPerformed(evt);
            }
        });

        cadastroFuncionariosRotuloCPF.setText("CPF");

        cadastroFuncionariosCampoCPF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroFuncionariosCampoCPFActionPerformed(evt);
            }
        });

        cadastroFuncionariosRotuloEndereco.setText("Endereço");

        cadastroFuncionariosCampoRua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroFuncionariosCampoRuaActionPerformed(evt);
            }
        });

        cadastroFuncionariosRotuloTelefone.setText("Telefone");

        cadastroFuncionariosCampoTelefone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroFuncionariosCampoTelefoneActionPerformed(evt);
            }
        });

        cadastroFuncionariosBotaoSalvar.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); // NOI18N
        cadastroFuncionariosBotaoSalvar.setText("Salvar");
        cadastroFuncionariosBotaoSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroFuncionariosBotaoSalvarActionPerformed(evt);
            }
        });

        cadastroFuncionariosBotaoCancelar.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); // NOI18N
        cadastroFuncionariosBotaoCancelar.setText("Cancelar");

        cadastroFuncionariosRotuloCargo.setText("Cargo");

        cadastroFuncionariosCampoCargo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroFuncionariosCampoCargoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cadastroFuncionariosRotuloCargo)
                    .addComponent(cadastroFuncionariosCampoCargo, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(100, 100, 100)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cadastroFuncionariosCampoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cadastroFuncionariosRotuloTelefone))
                .addContainerGap(4441, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addComponent(cadastrodeFuncionarios)
                .addContainerGap(4505, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cadastroFuncionariosRotuloNome, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cadastroFuncionariosCampoNome, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cadastroFuncionariosRotuloCPF)
                    .addComponent(cadastroFuncionariosCampoCPF, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(4201, 4201, 4201))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cadastroFuncionariosCampoRua, javax.swing.GroupLayout.DEFAULT_SIZE, 389, Short.MAX_VALUE)
                .addGap(4349, 4349, 4349))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cadastroFuncionariosRotuloEndereco)
                .addContainerGap(4670, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(156, 156, 156)
                .addComponent(cadastroFuncionariosBotaoSalvar)
                .addGap(65, 65, 65)
                .addComponent(cadastroFuncionariosBotaoCancelar)
                .addContainerGap(4396, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addComponent(cadastrodeFuncionarios)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastroFuncionariosRotuloNome)
                    .addComponent(cadastroFuncionariosRotuloCPF, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastroFuncionariosCampoNome)
                    .addComponent(cadastroFuncionariosCampoCPF))
                .addGap(12, 12, 12)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastroFuncionariosRotuloCargo)
                    .addComponent(cadastroFuncionariosRotuloTelefone))
                .addGap(6, 6, 6)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastroFuncionariosCampoCargo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cadastroFuncionariosCampoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(47, 47, 47)
                .addComponent(cadastroFuncionariosRotuloEndereco, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cadastroFuncionariosCampoRua, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(91, 91, 91)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastroFuncionariosBotaoCancelar)
                    .addComponent(cadastroFuncionariosBotaoSalvar))
                .addGap(3528, 3528, 3528))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cadastroFuncionariosCampoNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroFuncionariosCampoNomeActionPerformed
        String campoNome = cadastroFuncionariosCampoNome.getText();

    }//GEN-LAST:event_cadastroFuncionariosCampoNomeActionPerformed

    private void cadastroFuncionariosCampoCargoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroFuncionariosCampoCargoActionPerformed
        String campoCargo = cadastroFuncionariosCampoCargo.getText();
    }//GEN-LAST:event_cadastroFuncionariosCampoCargoActionPerformed

    private void cadastroFuncionariosCampoCPFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroFuncionariosCampoCPFActionPerformed
        String campoCpf =  cadastroFuncionariosCampoCPF.getText();

    }//GEN-LAST:event_cadastroFuncionariosCampoCPFActionPerformed

    private void cadastroFuncionariosCampoTelefoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroFuncionariosCampoTelefoneActionPerformed
        String campoTelefone =  cadastroFuncionariosCampoTelefone.getText();
    }//GEN-LAST:event_cadastroFuncionariosCampoTelefoneActionPerformed

    private void cadastroFuncionariosCampoRuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroFuncionariosCampoRuaActionPerformed
        String campoEndereco = cadastroFuncionariosCampoRua.getText();
    }//GEN-LAST:event_cadastroFuncionariosCampoRuaActionPerformed

    private void cadastroFuncionariosBotaoSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroFuncionariosBotaoSalvarActionPerformed
        if(cadastroFuncionariosCampoNome.getText()!=null){
             cadastroFuncionariosBotaoSalvar.setEnabled(true);
            }

        String campoNome = cadastroFuncionariosCampoNome.getText();
        String campoCargo = cadastroFuncionariosCampoCargo.getText();
        String campoCpf =  cadastroFuncionariosCampoCPF.getText();
        String campoTelefone =  cadastroFuncionariosCampoTelefone.getText();
        String campoEndereco = cadastroFuncionariosCampoRua.getText();
        
        PersistenciaFuncionario pf = PersistenciaFuncionario.getInstance();
        pf.cadastroFuncionario(campoNome,campoCpf,campoEndereco,campoTelefone,campoCargo);

    }//GEN-LAST:event_cadastroFuncionariosBotaoSalvarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CadastroFuncionario().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton cadastroFuncionariosBotaoCancelar;
    private javax.swing.JButton cadastroFuncionariosBotaoSalvar;
    private javax.swing.JTextField cadastroFuncionariosCampoCPF;
    private javax.swing.JTextField cadastroFuncionariosCampoCargo;
    private javax.swing.JTextField cadastroFuncionariosCampoNome;
    private javax.swing.JTextField cadastroFuncionariosCampoRua;
    private javax.swing.JTextField cadastroFuncionariosCampoTelefone;
    private javax.swing.JLabel cadastroFuncionariosRotuloCPF;
    private javax.swing.JLabel cadastroFuncionariosRotuloCargo;
    private javax.swing.JLabel cadastroFuncionariosRotuloEndereco;
    private javax.swing.JLabel cadastroFuncionariosRotuloNome;
    private javax.swing.JLabel cadastroFuncionariosRotuloTelefone;
    private javax.swing.JLabel cadastrodeFuncionarios;
    // End of variables declaration//GEN-END:variables

}
